import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    { path: '/', redirect: '/login' },
    { path: '/mdedit', component: resolve => require(['../components/page/MdEdit.vue'], resolve) },
    { path: '/login', component: resolve => require(['../components/page/Login.vue'], resolve) },
    { path: '/active/:token', component: resolve => require(['../components/page/Active.vue'], resolve),props:true },
    { path: '/register', component: resolve => require(['../components/page/Register.vue'], resolve) },
    { path: '/project', component: resolve => require(['../components/page/Project.vue'], resolve) },
    { path: '/projectSetting/:id', component: resolve => require(['../components/page/ProjectSetting.vue'], resolve) ,props: true},
    {
        path: '/index/:id',
        component: resolve => require(['../components/common/Index.vue'], resolve),
        props: true,
        children: [ 
            {
                path: '',
                component: resolve => require(['../components/page/MdEdit.vue'], resolve)
            }, 
            {
                path: '*',
                component: resolve => require(['../components/page/404.vue'], resolve),
            }
        ]
    },
    {
        path: '*',
        component: resolve => require(['../components/page/404.vue'], resolve),
    }
]

export default new VueRouter({
    routes // （缩写）相当于 routes: routes
})